package com.lego.service.impl;

import java.util.List;

import com.lego.bean.User;
import com.lego.bean.UserReviewVO;
import com.lego.dao.UserDao;
import com.lego.dao.impl.UserDaoImpl;
import com.lego.service.UserService;

public class UserServiceImpl implements UserService {

	UserDao ud = new UserDaoImpl();
	@Override
	public int userRegister(String userName, String password, String phoneNum) {
		if(ud.selectUserByName(userName)!=null) {
			return -1;
		}
		return ud.register(userName,password,phoneNum);
	}
	@Override
	public User loginUser(String userName, String password) {
		// TODO Auto-generated method stub
		return ud.selectUser(userName, password);
	}
	@Override
	public User selectUserByname(String userName) {
		// TODO Auto-generated method stub
		return ud.selectUserByName(userName);
	}
	@Override
	public List<UserReviewVO> selectUserReviewVO(int goodsId) {
		// TODO Auto-generated method stub
		return ud.selectUserReviewVO(goodsId);
	}
	@Override
	public int changeNickName(String nickName, int userId) {
		return ud.changeNickName(nickName,userId);
	}
	@Override
	public int changePwd(String password, int userId) {
		return ud.changePwd(password,userId);
	}
	@Override
	public int changeHeadImg(String visitPath, int userId) {
		return ud.changeHeadImg(visitPath, userId);
	}
	@Override
	public int queryUsersRow(String userName) {
		return ud.queryUsersRow(userName);
	}
	@Override
	public List<User> queryAllUsers(String userName,int pageNum, int pageSize) {
		return ud.queryAllUsers(userName,pageNum,pageSize);
	}
	@Override
	public int deleteUser(int userId) {
		return ud.deleteUser(userId);
	}
	@Override
	public int changeUserStatus(int i, int userId) {
		return ud.changeUserStatus(i,userId);
	}
	@Override
	public int modifyUser(User user) {
		return ud.updateUser(user);
	}

}
